#include<stdio.h>
void snakematrix(int a[100][100], int n,int line,int column,int number);
int main()
{
   int matrix[100][100];
   int n;
   scanf("%d",&n);
   int line=0,column=0,number=1;
   snake(matrix,n,line,column,number);
   for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
    {
        printf("%d",matrix[i][j]);
        if(j!=n-1) printf(" ");
        else printf("\n");
    }
    return 0;
}

snakematrix(int a[100][100], int n,int line,int column,int number)
{
     if(line!=n-1&&column!=n-1)
     {
       a[line][column]=number;
       number++;
       if(line==0) 
       {
         line=column+1;
         column=0;
       }
       else
       {
         line--;
         column++;
       }   
       snakematrix(a,n,line,column,number);
     }
     
}